package com.atldy.commerce.service.hystrix;

import cn.hutool.json.JSONUtil;
import com.atldy.commerce.service.OpenfeignTokenService;
import com.atldy.commerce.vo.JwtToken;
import com.atldy.commerce.vo.UsernameAndPassword;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @version 1.0
 * @Author: li-dong-yang
 * @CreateTime: 2021-09-13 7:22
 * @Description： openFeign集成Hystrix  ，兜底方法
 */
@Slf4j
@Component("openfeignTokenServiceFallback")
public class OpenfeignTokenServiceFallback implements OpenfeignTokenService {

    @Override
    public JwtToken getOpenfeignToken(UsernameAndPassword usernameAndPassword) {
        log.info("get jwtToken info  Fallback  parameter [{}]", JSONUtil.toJsonStr(usernameAndPassword));
        return new JwtToken("OpenfeignTokenServiceFallback");
    }
}